package com.ling.module1sbbyyds.controller.usercenter;

import com.ling.module1sbbyyds.service.news.usercenter.UserAttService;
import com.ling.sbbyyds.interaction.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/userAtt/")
public class UserAttController {

    @Autowired
    private UserAttService userAttService;

    /**
     * /api/userAtt/isLogin/attUser
     * 关注用户
     *
     * @param beiUserId 要关注的用户id
     * @param flag      true：进行关注 false：取消关注
     * @return
     */
    @GetMapping("isLogin/attUser")
    public ResultVo attUser(@RequestParam("beiUserId") Long beiUserId, @RequestParam("flag") Boolean flag) {
        return userAttService.attUser(beiUserId,flag);
    }


    /**
     * /api/userAtt/isLogin/getAttUserList
     * 获取关注用户列表
     *
     * @param page
     * @param limit
     * @return
     */
    @GetMapping("isLogin/getAttUserList")
    public ResultVo getAttUserList(@RequestParam("page") Integer page, @RequestParam("limit") Integer limit) {
        return userAttService.getAttUserList(page,limit);
    }


    /**
     * /api/userAtt/isLogin/getFriendsList
     * 获取好友用户列表
     *
     * @param page
     * @param limit
     * @return
     */
    @GetMapping("isLogin/getFriendsList")
    public ResultVo getFriendsList(Integer page, Integer limit) {
        return userAttService.getFriendsList(page, limit);
    }

}
